﻿@model iemtm.WeChat.Web.Entry.Areas.Admin.Model.AnnouceDetailModel
@{
    ViewBag.Title = "通知详情";
}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>中国铁塔油机管理系统-@ViewBag.Title</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="~/Content/css/frozenui.css">
    <link rel="stylesheet" href="~/Content/css/style.css">
    <link rel="stylesheet" href="~/Content/css/swiper.min.css">
    <link href="~/Content/css/aui.css" rel="stylesheet" />
    <script src="~/Content/script/swiper.min.js"></script>
    <script src="~/Content/script/jquery-3.3.1.min.js"></script>
    <link rel="stylesheet" href="~/Content/css/weui.min.css">
    <link rel="stylesheet" href="~/Content/css/jquery-weui.min.css">
    <script src="~/Content/script/jquery-1.11.0.min.js"></script>
    <script src="~/Content/script/jquery-weui-1.2.1.min.js"></script>


    <style>
        * {
            padding: 0;
            margin: 0;
        }

        html, body {
            position: relative;
            height: 100%;
        }

        li, a {
            list-style: none;
            text-decoration: none;
        }

        .swiper-container {
            width: 100%;
        }

        #nav {
            background: #fff;
        }

            #nav .swiper-wrapper {
                box-sizing: border-box;
                margin: 0;
                line-height: 1.6rem;
            }

            #nav li {
                text-align: center;
                color: #424242;
                font-size: 0.63rem;
            }

                #nav li span {
                    color: #3597D9;
                }

            #nav .active-nav {
                color: #2ECA70;
                border-bottom: 2px solid #2ECA70;
            }

                #nav .active-nav span {
                    color: #2ECA70;
                }



        #page {
            position: absolute;
            top: 1.68rem;
            left: 0;
            right: 0;
            bottom: 1.6rem;
            overflow: hidden;
        }

            #page .swiper-slide {
                text-align: center;
                overflow-y: scroll;
                position: relative;
                padding-top: 5px;
                box-sizing: border-box;
            }

        #tableHeader {
            height: 1.6rem;
        }

            #tableHeader table {
                width: 100%;
                height: 1.6rem;
                color: #fff;
                font-size: 0.6rem;
            }

                #tableHeader table tr th {
                    text-align: center;
                }

                #tableHeader table th:nth-child(even) {
                    background: #4FC2A1;
                }

                #tableHeader table th:nth-child(odd) {
                    background: #334960;
                }

        #content {
            position: absolute;
            top: 2.1rem;
            left: 0;
            right: 0;
            bottom: 0;
            overflow-y: scroll;
        }

            #content table {
                /*background: #fff;*/
                width: 100%;
                border-bottom: 1px solid #ccc;
            }

                #content table td {
                    word-break: break-word;
                    text-align: center;
                    border-right: 1px solid #ccc;
                }

                #content table tr td:last-child {
                    border-right: none;
                }

        #page table tr:nth-child(even) {
            background: #F8F8F8;
        }

        #page tr td {
            font-size: 0.64rem;
            color: #000;
            padding: 10px 0;
            font-family: "微软雅黑";
        }

            #page tr td:nth-child(1) {
                width: 20%;
            }

            #page tr td:nth-child(2), #page tr td:nth-child(3) {
                width: 25%;
            }

            #page tr td:nth-child(4), #page tr td:nth-child(5) {
                width: 15%;
            }



        #footer {
            position: absolute;
            height: 1.6rem;
            left: 0;
            right: 0;
            bottom: 0;
            padding: 0;
            margin: 0;
            background-color: #00bcd4;
        }

            #footer .ui-btn-primary {
                height: 1.6rem;
                width: 100%;
                line-height: 1.6rem;
                font-size: 0.68rem;
            }
    </style>
</head>
<body>



    <div id="nav" class="swiper-container">
        <ul class="swiper-wrapper">
            <li class="swiper-slide active-nav">通知详情</li>
            <li class="swiper-slide">发电记录</li>
        </ul>
    </div>

    <div class="swiper-container" id="page">
        <div class="swiper-wrapper">
            <div class="swiper-slide slidepage">
                <table cellpadding="0" cellspacing="0">
                    <tr>
                        <td>油机管理平台工单号:</td>
                        <td id="annouceCode">@Model.AnnounceList.AnnounceCode</td>
                    </tr>
                    <tr>
                        <td>基站名称:</td>
                        <td>@Model.AnnounceList.BaseStation</td>
                    </tr>
                    <tr>
                        <td>通知状态:</td>
                        <td class="aui-text-info">@Model.AnnouceStatus</td>
                    </tr>
                    <tr>
                        <td>工单告警时间:</td>
                        <td>@Model.AnnounceList.AlarmBeginTime</td>
                    </tr>
                    <tr>
                        <td>动环建单时间:</td>
                        <td>@Model.AnnounceList.ExecutionDate</td>
                    </tr>
                    <tr>
                        <td>派单人员:</td>
                        <td>@Model.AnnounceList.AnnouncePerson</td>
                    </tr>
                    <tr>
                        <td>发电区域:</td>
                        <td>@Model.AnnounceList.AreaName</td>
                    </tr>
                    <tr>
                        <td>接单人员:</td>
                        <td>@Model.AnnounceList.AcceptPersonName</td>
                    </tr>
                    <tr>
                        <td>带载时长:</td>
                        <td>@Model.CountPeriod.ToString("0.00")H (<span>@{ Model.CountPeriod = Model.CountPeriod * 60;}@Model.CountPeriod.ToString("0.0")</span>分)</td>
                    </tr>
                    <tr>
                        <td>发电电量:</td>
                        <td>@Model.CountKWpower KW</td>
                    </tr>
                    <tr>
                        <td>动环建单时间:</td>
                        <td>@Model.AnnounceList.JobNumber</td>
                    </tr>
                    <tr>
                        <td>油机:</td>
                        <td>
                            @Model.GensetNum
                        </td>
                    </tr>
                    <tr>
                        <td>采集器:</td>
                        <td>
                            <a href=@ViewBag.realDataUrl>@Model.AnnounceList.RegisteredDtuId</a>
                        </td>
                    </tr>
                    <tr>
                        <td>是否为多签工单:</td>
                        <td class="aui-text-info">
                            @if (Model.AnnounceList.IsReBinGenset == true)
                            {
                                @("是")
                            }
                            else
                            {
                                @("否")
                            }
                        </td>
                    </tr>
                    <tr>
                        <td>是否更换过油机:</td>
                        <td class="aui-text-info">
                            @if (Model.AnnounceList.IsChangeGenset == true)
                            {
                                @("是")
                            }
                            else
                            {
                                @("否")
                            }
                        </td>
                    </tr>
                </table>
            </div>
            <div class="swiper-slide slidepage">
                <div id="tableHeader">
                    <table cellpadding="0" cellspacing="0">
                        <tr>
                            <th width="20%">模块编号</th>
                            <th width="25%">开始</th>
                            <th width="25%">结束</th>
                            <th width="15%">空/带载(H)</th>
                            <th width="15%">距离(米)</th>
                        </tr>
                    </table>
                </div>
                <div id="content">
                    <table cellpadding="0" cellspacing="0">
                        @{
                            foreach (var item in Model.GenRecord)
                            {
                                <tr>
                                    <td>@item.DTUID</td>
                                    <td>@item.GenStart.Value.ToString("MM-dd HH:mm")</td>
                                    <td>@item.GenStop.Value.ToString("MM-dd HH:mm")</td>
                                    <td>@item.EmptyloadPeriod.ToString("0.00")/@item.RunningPeriod.Value.ToString("0.00")</td>
                                    <td>@item.Distance.Value.ToString("0")</td>
                                </tr>
                            }
                        }
                    </table>
                </div>
            </div>
        </div>
    </div>

    <section class="ui-container actionOne">
        <section id="actionsheet">
            <div class="demo-item">
                <div class="demo-block">
                    <div class="ui-actionsheet" id="actionsheet1">
                        <div class="ui-actionsheet-cnt am-actionsheet-down">
                            <h4>选择操作菜单</h4>
                            @{
                                if (Model.AnnounceList.AnnounceStatus == 20)
                                {
                                    <button id="bindGenset">签到</button>
                                }
                                if (Model.AnnounceList.AnnounceStatus > 21 && Model.AnnounceList.AnnounceStatus < 29)
                                {
                                    <button id="ChangeAnnGenset">更换油机</button>
                                }
                                if (Model.AnnounceList.AnnounceStatus > 21 && Model.AnnounceList.AnnounceStatus < 29)
                                {
                                    <button id="ReBinAnnGenset">增加油机</button>
                                }
                                if (Model.AnnounceList.AnnounceStatus == 21)//待上站
                                {
                                    <button id="resStartBind">绑定</button>
                                }
                                if (Model.AnnounceList.AnnounceStatus >= 20 && Model.AnnounceList.AnnounceStatus <= 28)
                                {
                                    <button id="replyGenset">回单</button>
                                }
                            }
                            <button id="returnList">返回列表</button>
                            <div class="ui-actionsheet-split-line"></div>
                            <button id="cancel">取消</button>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </section>

    <div class="ui-btn-wrap" id="footer">
        <button class="ui-btn-primary">
            操作
        </button>
    </div>

    <script>
            (function (designWidth, maxWidth) {
                var html = document.getElementsByTagName("html")[0];
                var tid;
                function refreshRem() {
                    var width = html.getBoundingClientRect().width;
                    html.style.fontSize = width / 15 + "px"
                }
                window.addEventListener("resize", function () {
                    clearTimeout(tid); //防止执行两次
                    tid = setTimeout(refreshRem, 300);
                }, false);
                refreshRem();
            })();


            (function (doc, win) {

                var size = 10;
                var myNav = new Swiper('#nav', {
                    spaceBetween: 10,
                    slidesPerView: 2,
                    watchSlidesProgress: true,
                    watchSlidesVisibility: true,
                    on: {
                        tap: function () {
                            myPage.slideTo(myNav.clickedIndex)
                        }
                    }
                });

                var myPage = new Swiper('#page', {
                    on: {
                        slideChangeTransitionStart: function () {
                            updateNavPosition()
                        }
                    }
                });

                function updateNavPosition() {
                    $('#nav .active-nav').removeClass('active-nav');
                    var activeNav = $('#nav .swiper-slide').eq(myPage.activeIndex).addClass('active-nav');
                    if (!activeNav.hasClass('swiper-slide-visible')) {

                        if (activeNav.index() >= myNav.activeIndex) {
                            var thumbsPerNav = Math.floor(myNav.width / activeNav.width()) - 1
                            myNav.slideTo(activeNav.index() - thumbsPerNav)
                        } else {
                            myNav.slideTo(activeNav.index())
                        }
                    }
                }

                $("#footer").click(function () {
                    $('.ui-actionsheet').addClass('show');

                });

                $("#cancel").click(function () {
                    $(".ui-actionsheet").removeClass("show");
                });

                $("#goBack").click(function () {

                    window.history.back()
                })

            })(document, window);

            @*if ('@Model.AnnounceList.AcceptPersonCode'==null) {
                console.log("111");
            }

            var userCode='@Model.AnnounceList.AcceptPersonCode';

            if (@Model.AnnounceList.AnnounceStatus==20) {
                $("#replyGenset").click(function(){
                    location.href = "/AnnouceList/ReplyGenset?annouceCode=" + $("#annouceCode").html() + "&AnnounceStatus=" +@Model.AnnounceList.AnnounceStatus+"";
                })
            }else {
                $("#replyGenset").click(function(){
                    location.href = "/AnnouceList/ReplyGenset?annouceCode=" + $("#annouceCode").html() + "&AnnounceStatus=" +@Model.AnnounceList.AnnounceStatus+"&userCode="+@Model.AnnounceList.AcceptPersonCode+"";
                })
            }*@
            $("#replyGenset").click(function(){
                location.href = "/AnnouceList/ReplyGenset?annouceCode=" + $("#annouceCode").html() + "&AnnounceStatus=" +@Model.AnnounceList.AnnounceStatus+"&userCode=@Model.AnnounceList.AcceptPersonCode";
            })



            //待上站重新绑定签到
            $("#resStartBind").click(function () {
                location.href = "/AnnouceList/BinGenset?annouceCode=" + $("#annouceCode").html() + "&AnnounceStatus="+@Model.AnnounceList.AnnounceStatus+"";
            })

            //添加油机事件
            $("#ReBinAnnGenset").click(function () {
                location.href = "/AnnouceList/ReBinGenset?annouceCode=" + $("#annouceCode").html() + "&AnnounceId="+@Model.AnnounceList.AnnounceId+"";
            })

            //绑定发电机事件
            $("#bindGenset").click(function () {
                location.href = "/AnnouceList/BinGenset?annouceCode=" + $("#annouceCode").html() + "&AnnounceStatus="+@Model.AnnounceList.AnnounceStatus+"";
            });

            //更换油机事件
            $("#ChangeAnnGenset").click(function () {
                location.href = "/AnnouceList/ChangeAnnGenset?annouceCode=" + $("#annouceCode").html() + "&AnnounceId="+@Model.AnnounceList.AnnounceId+"";
            })

            //返回列表
            $("#returnList").click(function () {
                location.href = "/AnnouceList/Index";
            });
    </script>
</body>
</html>
